package text_modification;
import java.io.IOException;
import java.util.Scanner;


public class Text_Modification {


    public static void main(String[] args) throws IOException {
        String filename = "C:/Users/user/Desktop/TestFile.txt";
        
        try{
            int i;
            ReadFile file = new ReadFile(filename);
            String[] arrLines = file.OpenFile();  
            for (i=0;i<arrLines.length;i++){
                System.out.println(arrLines[i]);
            }
        }
        
        catch(IOException e){
            System.out.println(e.getMessage());
        }
        
    //==============================================
    //              WRITE TO FILE
    //==============================================\
        int a;
        Scanner input = new Scanner(System.in);
        System.out.println("Insert number of line you want to imput");
        int numberOfLines = input.nextInt();
        String[] arrLines = new String[numberOfLines];
        System.out.println("Please input each line followed with enter key");
        for (a=0; a<numberOfLines; a++){
            arrLines[a] = input.next();
        }
        WritetoFile data = new WritetoFile(filename, true);
        for (a=0; a<numberOfLines; a++){
            data.Writing(arrLines[a]);
        }
    }
    
}
